/**
 * 
 */
package br.srv.full.virtual.entities.auth;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.MappedSuperclass;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import br.srv.full.virtual.bean.base.EntityBean;

/**
 * @author Delfino
 * 
 */
@MappedSuperclass
@DiscriminatorColumn(name = "usertype", discriminatorType = DiscriminatorType.CHAR)
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "persons")
public class Person implements EntityBean {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2112889221254426098L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name = "personid")
	private Integer id;

	@Column(name = "username", length = 50, nullable=false)
	private String name;

	@Column(name = "useraka", length = 20)
	private String aka;

	@Column(name = "useremail", unique = true, length = 40)
	private String email;

	@Column(name = "registrationid", length = 36, unique = true, insertable = true, updatable = false, nullable = false)
	@OrderBy
	private String registrationId;

	@Temporal(TemporalType.TIMESTAMP)
	private Date registrationDate;

	@Temporal(TemporalType.TIMESTAMP)
	private Date lastUpdateDate;

	@Column(length = 6)
	private String reduzedId;

	/**
	 * @return
	 */
	public String getAka() {
		return aka;
	}

	/**
	 * @param p_aka
	 */
	public void setAka(String p_aka) {
		this.aka = p_aka;
	}

	/**
	 * @return
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return
	 */
	public Integer getId() {
		return id;
	}

	/**
	 * @param id
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the lastUpdateDate
	 */
	public Date getLastUpdateDate() {
		return lastUpdateDate;
	}

	/**
	 * @param p_lastUpdateDate
	 *            the lastUpdateDate to set
	 */
	public void setLastUpdateDate(Date p_lastUpdateDate) {
		lastUpdateDate = p_lastUpdateDate;
	}

	/**
	 * @return the registrationDate
	 */
	public Date getRegistrationDate() {
		return registrationDate;
	}

	/**
	 * @return
	 */
	public String getRegistrationId() {
		return registrationId;
	}

	/**
	 * @param registrationId
	 */
	public void setRegistrationId(String registrationId) {
		this.registrationId = registrationId;
	}

	/**
	 * @param p_registrationDate
	 */
	public void setRegistrationDate(Date p_registrationDate) {
		registrationDate = p_registrationDate;
	}

	/**
	 * @return the reduzedId
	 */
	public String getReduzedId() {
		return reduzedId;
	}

	/**
	 * @param p_reduzedId
	 *            the reduzedId to set
	 */
	public void setReduzedId(String p_reduzedId) {
		reduzedId = p_reduzedId;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return getClass().getSimpleName() + " -> " + getName() + ", Apelido: " + getAka() + ", E-Mail: " + getEmail();
	}
}
